import React, { useState, useEffect } from 'react';
import {View, Text,StyleSheet} from 'react-native';
import {primaryBackgroundColor, primaryColor2,secondaryColor} from '../../../theme/default';
import {useTranslation} from 'react-i18next';
import { getTestDetail } from '../../../api/backend';

export function NotificationDetailView({route, navigation}: any) {
  const {t} = useTranslation();
  const {id} = route.params;
  const [data, setData] = useState([]); // 存储接口返回的数据
  const [loading, setLoading] = useState(false); // 加载状态
  console.log(333333);
  console.log(id);

  const fetchData = async () => {
   
    try {
      const response = await getTestDetail(id);
      // 更新数据状态
      setData(response);
     
    } catch (err) {
      setLoading(false);
    }
  };
  // 组件挂载时获取数据
  useEffect(() => {
    fetchData();
  }, []);
  return (
    <View style={styles.container}>
      <Text style={{color: primaryColor2}}>{data.name}</Text>
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: primaryBackgroundColor,
  },
});
